package com.googlecode.continuity.core.client;

import java.util.Set;

/**
 * ContinuityGroup is an interface used to handle sets of users. Groups are used for various purposes such as assigning
 * a set of rights to a set of users or to associate a set of users with another object.
 * <p/>
 * todo: add remove member
 *
 * @author Peter Schmitt <aragos@aragos.de>
 * @see Group
 */
public interface ContinuityGroup {
  /**
   * Returns <code>true</code> if the user is a member of this group.
   *
   * @param user possible member
   * @return <code>true</code> when the user is a member of this group, false otherwise
   */
  public boolean isMember(ContinuityUser user);

  /**
   * Sets the members of this group.
   *
   * todo: remove?
   * @param members new members of this group
   */
  public void setMembers(Set members);

  /**
   * Sets a new name for this group.
   *
   * @param name new group name
   */
  public void setName(String name);

  /**
   * Returns the members of this group.
   *
   * @return members of this group.
   */
  public Set getMembers();

  /**
   * Returns the name of this group.
   *
   * @return the name of this group
   */
  public String getName();

  /**
   * Returns the number of members in this group.
   *
   * @return number of members in this group
   */
  public int getSize();

  /**
   * Returns this group's unique id.
   *
   * @return the group's id
   */
  public int getId();

  /**
   * Adds a member to this group.
   *
   * @param member the user to be added to this group
   */
  public void addMember(ContinuityUser member);
}
